<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <title>合租房价格地理位置分布</title>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=kq8OFFIGpdD7nrf52t1cXVP99pNzUH9G"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/library/Heatmap/2.0/src/Heatmap_min.js"></script>
    <!--<script src="http://code.jquery.com/jquery-latest.js"></script>-->
    <script  src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript">
//        $(document).ready(function(){
////        function getDate(){
//;
//        });
    </script>

    <style type="text/css">
        ul, li {
            list-style: none;
            margin: 0;
            padding: 0;
            float: left;
        }

        html {
            height: 100%;
        }

        body {
            height: 100%;
            margin: 0px;
            padding: 0px;
            font-family: "微软雅黑";
        }

        #container {
            height: 100%;
            width: 100%;
        }

        #r-result {
            width: 100%;
        }
    </style>
</head>

<body>
    <div id="container"></div>
    <!--<button type="button" name="button" onclick="getDate()">Click Me!</button>-->
</body>
</html>
<script type="text/javascript" >
//    var map = new BMap.Map("allmap");
////    map.centerAndZoom("重庆",12);  //初始化地图,设置城市和地图级别。
//    var pointA = new BMap.Point(120.227155,30.325279);  // 创建点坐标A--大渡口区
//    var pointB = new BMap.Point(119.987027,30.248041);  // 创建点坐标B--江北区
//    alert('从大渡口区到江北区的距离是：'+(map.getDistance(pointA,pointB)).toFixed(2)+' 米。');  //获取两点距离,保留小数点后两位

    $.get("http://localhost:8080/ziroom/map", function (res) {
        console.log(res.data);
        var points = eval(res.data);
        var map = new BMap.Map("container"); // 创建地图实例
        var point = new BMap.Point(120.19,30.26);//杭州市

        map.centerAndZoom(point, 11); // 初始化地图，设置中心点坐标和地图级别
        map.enableScrollWheelZoom(); // 允许滚轮缩放
        var point = new Array(); //存放标注点经纬信息的数组
        var marker = new Array(); //存放标注点对象的数组
        var opacity = 0.1;
//        debugger;
        for (var i = 0; i < points.length; i++) {
            var p0 = points[i].lng;
            var p1 = points[i].lat;
            point[i] = new window.BMap.Point(p0, p1); //循环生成新的地图点
            if(points[i].count==5)
                marker[i] = new window.BMap.Circle(point[i],500,{strokeColor:"#7700FF",fillColor:"#7700FF",fillOpacity:opacity,strokeWeight:0, strokeStyle:"solid", strokeOpacity:0.01}); //按照地图点坐标生成标记
            else if(points[i].count==10)
                marker[i] = new window.BMap.Circle(point[i],500,{strokeColor:"#4DFC42",fillColor:"#4DFC42",fillOpacity:opacity,strokeWeight:0, strokeStyle:"solid", strokeOpacity:0.01}); //按照地图点坐标生成标记
            else
                marker[i] = new window.BMap.Circle(point[i],500,{strokeColor:"#FF0A00",fillColor:"#FF0A00",fillOpacity:opacity,strokeWeight:0, strokeStyle:"solid", strokeOpacity:0.01}); //按照地图点坐标生成标记
            map.addOverlay(marker[i]);
        }
    });


</script>